package com.woniuxy.main.handler;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.woniuxy.main.mapper.FacilityMapper;
import com.woniuxy.main.pojo.Facility;
import com.woniuxy.main.pojo.Room;
import com.woniuxy.main.service.RoomService;

@Controller
@RequestMapping("/room")
public class RoomHandler {
	
	@Autowired
	private RoomService roomService;
	@Autowired
	
	
	@RequestMapping("/all")
	@ResponseBody
	public List<Room> loadRoom(){
		List<Room> allRoom = roomService.loadAllRoom();
		return allRoom;
	}



	/**查询:当前进过逻辑判断,实际可住房间
	 *
	 * @return 可入住房间集合
	 * @throws Exception
	 */
	@RequestMapping("/availableRoom")
	@ResponseBody
	Map availableRoom()throws Exception{
		List<Room> rooms = roomService.availableRoom();
		Map<String, Object> result = new LinkedHashMap<String, Object> ();
		result.put("code", 0);
		result.put("msg", "");
		result.put("count", rooms.size());
		result.put("data", rooms);
		return result;

	}

}
